//
//  UIImage+Extension.swift
//  weibo
//
//  Created by yanghong on 15/12/16.
//  Copyright © 2015年 杨鸿. All rights reserved.
//

import UIKit

extension UIImage {

   //获取当前屏幕内容的图片
    
    class func screenShoot() -> UIImage {
       
        let window = UIApplication.sharedApplication().keyWindow!
        //开启上下文
        UIGraphicsBeginImageContext(window.bounds.size)
        
        window.drawViewHierarchyInRect(window.bounds, afterScreenUpdates: false)
        
        let image = UIGraphicsGetImageFromCurrentImageContext()
        
         //关闭上下文
        UIGraphicsEndImageContext()
        
        return image
    }

}
